Skip to content

Conversation

@SYM01
Copy link
Collaborator

@SYM01 SYM01 commented Jun 8, 2025

No description provided.

SYM01 and others added 21 commits October 21, 2024 01:47
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](ai/nanoid@3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix 401 issue (#22)

* enablle github action on develop branch
* Adapt firefox
* support firefore auto publish
* support firefox, and optimized UX
* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* [i18n] Translate messages.json in zh_CN

100% reviewed source file: 'messages.json'
on 'zh_CN'.

* [i18n] Translate messages.json in zh_TW

100% reviewed source file: 'messages.json'
on 'zh_TW'.

* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* update English i18n msg

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: SYM01 <33443792+SYM01@users.noreply.github.com>
* implemented an utility to export/import settings
* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* [i18n] Translate messages.json in zh_TW

100% reviewed source file: 'messages.json'
on 'zh_TW'.

* [i18n] Translate messages.json in zh_CN

100% reviewed source file: 'messages.json'
on 'zh_CN'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* [WIP] support chrome auto deploy

* finalize Chrome auto deploy

* npm audit fix

* npm audit fix
* minor bug fixed

* improve UX and close #28

* use the same CIDR validator as PAC script
* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* [i18n] Translate messages.json in zh_TW

100% reviewed source file: 'messages.json'
on 'zh_TW'.

* [i18n] Translate messages.json in zh_CN

100% reviewed source file: 'messages.json'
on 'zh_CN'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* update deps

* fix the auth issue in auto switch profiles

* fix typo
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @SYM01, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello team,

Gemini here to provide a summary of this pull request titled "v1.2.3: Support Auto Switch Authentication".

Based on the title and the changes, the primary goal of this PR is to enhance the functionality of the 'Auto Switch' proxy profile type. This includes adding validation for the conditions used in auto-switch rules (specifically URL and CIDR types) and, importantly, implementing a mechanism to correctly retrieve authentication information from profiles that are referenced within an auto-switch profile structure. This ensures that when an auto-switch profile directs traffic to another profile requiring authentication, the necessary credentials can be provided.

The PR also includes various dependency updates and some minor code structure improvements.

Highlights

  • Enhanced Auto Switch Profile: The 'auto' proxy profile type has been significantly enhanced. It now includes validation for the 'condition' field in its rules, specifically for URL and CIDR types. A new ProfileAuthProvider class has been introduced to recursively traverse the profile structure (including nested auto-switch profiles) to find relevant authentication information for a given host and port.
  • Input Validation for Auto Switch Rules: Validation rules have been added to the Auto Switch input component (AutoSwitchInput.vue) to check the format of URL and CIDR conditions. This includes a specific warning message for Chrome users regarding limitations on path matching in HTTPS URLs.
  • Dependency Updates: Several project dependencies have been updated in package.json, including @sentry/vue, @vueuse/core, acorn, vue, vue-router, @arco-design/web-vue, @sentry/vite-plugin, @vitest/coverage-v8, typescript, vite, and vitest.
  • Code Structure and Refactoring: Introduced a BrowserFlavor enum and getter in the adapter layer. Renamed ProfileAuthSwitch to ProfileAutoSwitch for clarity across the codebase. Added a saveManyProfiles function for more efficient bulk profile saving. Implemented the ProfileAuthProvider for handling authentication lookup in complex profile setups.
  • Localization Updates: Added new localization strings in English, Brazilian Portuguese, Simplified Chinese, and Traditional Chinese for the new URL and CIDR validation error messages.

Changelog

Click here to see the changelog
  • package.json
    • Updated various dependencies to newer versions (e.g., @sentry/vue from 8.51.0 to 8.55.0, vue from 3.5.13 to 3.5.16, vite from 6.0.7 to 6.3.5).
  • public/_locales/en/messages.json
    • Added new localization keys for URL validation errors (config_section_auto_switch_type_url_malformed, config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) (lines 110-120).
    • Removed empty lines (lines 203-204).
  • public/_locales/pt_BR/messages.json
    • Added new localization keys for URL validation errors (config_section_auto_switch_type_url_malformed, config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) in Portuguese (lines 110-120).
    • Removed empty lines (lines 203-204).
  • public/_locales/zh_CN/messages.json
    • Added new localization keys for URL validation errors (config_section_auto_switch_type_url_malformed, config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) in Simplified Chinese (lines 110-120).
    • Removed empty lines (lines 203-204).
  • public/_locales/zh_TW/messages.json
    • Added new localization keys for URL validation errors (config_section_auto_switch_type_url_malformed, config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) in Traditional Chinese (lines 110-120).
    • Removed empty lines (lines 203-204).
  • src/adapters/base.ts
    • Added BrowserFlavor enum (lines 53-57).
    • Added abstract flavor getter (lines 60-62).
  • src/adapters/chrome.ts
    • Imported BrowserFlavor (line 6).
    • Implemented flavor getter returning BrowserFlavor.Chrome (lines 16-18).
  • src/adapters/web.ts
    • Imported BrowserFlavor (line 6).
    • Implemented flavor getter returning BrowserFlavor.Web (lines 24-26).
  • src/components/PreferencePage.vue
    • Imported saveManyProfiles instead of saveProfile (line 4).
    • Updated profile import logic to use saveManyProfiles (line 26).
  • src/components/ProfileConfig.vue
    • Renamed import ProfileAuthSwitch to ProfileAutoSwitch (line 20).
    • Updated ConfigState type definition to use ProfileAutoSwitch (line 41).
    • Added type annotations to proxyServerFieldRule validator function signature (lines 135-138).
    • Added type annotations to pacScriptFieldRule validator function signature (lines 157-160).
    • Updated template to cast profile config to ProfileAutoSwitch for AutoSwitchPacPreview (line 430).
  • src/components/configs/AutoSwitchInput.vue
    • Imported FieldRule type (line 3).
    • Imported BrowserFlavor and isValidCIDR (lines 13-14).
    • Added getConditionInputRule function to provide validation rules based on rule type (lines 97-154).
    • Wrapped the table in a <form> element (line 158).
    • Wrapped select and input elements in <a-form-item> components and applied validation rules (lines 175-180, 192-203, 215-221).
    • Added CSS class auto-switch-form to remove bottom margin from form items within the table (lines 288-292).
  • src/components/configs/AutoSwitchPacPreview.vue
    • Renamed import ProfileAuthSwitch to ProfileAutoSwitch (line 3).
    • Updated prop type definition to use ProfileAutoSwitch (line 12).
  • src/components/configs/ProfileSelector.vue
    • Made the profileID model required (lines 16-18).
    • Adjusted the setter logic for selectedProfile to only set profileID.value if value is defined (lines 34-36).
    • Disabled the 'System' profile option when currentProfileID prop is provided (line 104).
  • src/components/configs/ProxyServerInput.vue
    • Cast proxyType model to string in the template select element (line 118).
  • src/services/profile.ts
    • Renamed type ProfileAuthSwitch to ProfileAutoSwitch (line 71).
    • Updated type ProxyProfile to include ProfileAutoSwitch (line 75).
    • Added JSDoc comment to saveProfile warning about promise safety (lines 111-116).
    • Added new asynchronous function saveManyProfiles to save multiple profiles efficiently (lines 123-128).
  • src/services/proxy/auth.ts
    • Added new file src/services/proxy/auth.ts containing the ProfileAuthProvider class.
    • The ProfileAuthProvider class provides a method getAuthInfos to recursively find authentication information within a profile structure, including nested auto-switch profiles, preventing infinite loops with a searchedProfiles set.
  • src/services/proxy/index.ts
    • Imported ProfileAutoSwitch (line 7).
    • Imported ProfileAuthProvider (line 11).
    • Updated the type hint for previewAutoSwitchPac parameter to ProfileAutoSwitch (line 84).
    • Refactored getAuthInfos function to use the new ProfileAuthProvider class for retrieving authentication information from any profile type, not just 'proxy' type (lines 93-99). Removed the previous manual check for 'proxy' type and the manual iteration over proxy rules.
  • src/services/proxy/profile2config.ts
    • Imported ProfileAutoSwitch (line 5).
    • Exported the ProfileLoader type (lines 17-19).
    • Added JSDoc comment to the toPAC method (lines 49-52).
    • Updated the type hint for prepareAutoProfilePrecedence parameter to ProfileAutoSwitch (line 308).
  • tests/services/proxy/auth.test.ts
    • Added a new test file tests/services/proxy/auth.test.ts.
    • Includes tests for the ProfileAuthProvider class, covering simple proxy profiles, auto-switch profiles, and auto-switch profiles with a default.
  • vite.config.ts
    • Added Sentry release configuration to the Sentry plugin settings, including inject and dist based on the CRX version and build mode (lines 108-111).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly enhances the auto-switch functionality by adding robust authentication support, especially for nested profiles. The introduction of ProfileAuthProvider is a well-designed solution for managing authentication information and preventing cycles. The new validation rules for URL and CIDR conditions in the auto-switch configuration improve user experience and data integrity.

Key improvements include:

  • ProfileAuthProvider: Centralizes authentication logic for all profile types, including complex auto-switch scenarios with nested profiles and cycle detection.
  • Input Validation: Added validation for URL and CIDR inputs in auto-switch rules, with browser-specific considerations for Chrome.
  • saveManyProfiles: Improves efficiency and atomicity for operations like profile import.
  • Code Clarity: Renaming ProfileAuthSwitch to ProfileAutoSwitch enhances readability.
  • Testing: New unit tests for ProfileAuthProvider ensure the correctness of the new authentication logic.

Overall, the changes are well-implemented and improve the feature set and robustness of the application. There's one minor cleanup item noted below.

Summary of Findings

  • Debugging Code: A console.log statement was found in src/components/configs/AutoSwitchInput.vue which should likely be removed.
  • Enhanced Authentication Logic: The new ProfileAuthProvider class effectively handles authentication credential retrieval for various profile types, including complex auto-switch configurations with nested profiles and cycle detection. This is a strong addition.
  • Improved Input Validation: Validation for URL and CIDR conditions in auto-switch rules, including browser-specific checks (e.g., Chrome's HTTPS path matching restriction), has been added, improving data quality and user feedback.
  • Refactoring and Efficiency: The introduction of saveManyProfiles for bulk profile operations and the consistent renaming of ProfileAuthSwitch to ProfileAutoSwitch are good improvements for efficiency and code clarity.

Merge Readiness

The pull request is in good shape and introduces valuable improvements. There is one minor medium severity issue (a leftover console.log) that should be addressed. Once that's resolved, the PR should be ready for merging. As an AI, I am not authorized to approve pull requests; please ensure further review and approval by authorized team members.

case "url":
return {
validator: async (value: string, cb: (message?: string) => void) => {
console.log("test");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It looks like there's a console.log("test") statement here. Was this intended for debugging and should it be removed before merging?

@SYM01 SYM01 merged commit de034a2 into main Jun 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants